// 03admin/17examine/02bizLicenseExamine/01bizLicenseExamineDetail/bizLicenseExamineDetail.js
var co = require('../../../../resource/js/common.js')
var app = getApp()
var _this, _data
Page({

   /**
    * 页面的初始数据
    */
   data: {
      bizDetail: '',
      Biz_Account: '',///////////////yersgvRC ////
      Biz_ID: '',//审核的商家ID

      examineResult: 0//审核的结果

   },

   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (option) {

      _this = this
      _data = this.data
      var Biz_ID = option.Biz_ID
      this.setData({
         Biz_Account: option.Biz_Account,
         Biz_ID: Biz_ID
      })
      this.getBizExamineDetail(Biz_ID)

   },
   //获取审核商家营业执照信息
   getBizExamineDetail: function (Biz_ID) {
      var url = 'biz/Bizmg/getAuthDetails'
      co.getShareApi(url, {
         Biz_ID: Biz_ID
      }, function (res) {
         if (res.code == 0) {
            
            _this.setData({
               bizDetail: res.data,
               examineResult: res.data.Auth_Status
            })
         } else {
            co.toastAllText(res.msg)
         }
      })
   },
   //放大营业执照图
   editTableCard: function (e) {
      //console.log('e====2',e)
      var src = e.currentTarget.dataset.src
      var srcList = []
      srcList.push(src)
      // console.log('table===', table)
      wx.previewImage({
         current: src, // 当前显示图片的http链接
         urls: srcList // 需要预览的图片http链接列表
      })
   },
   //通过审核
   examineYesOrNo(e) {
      var index = e.currentTarget.dataset.id
      var param = {
         Biz_ID: _data.Biz_ID,
         User_ID: app.Data.userInfo.User_ID,
      }
      if(index == "1"){
         param.status = 1
      }else{
         param.status = 2
      }
      co.getShareApi('biz/Bizmg/authingBusiness', param, function (res) {
         if (res.code == 0) {
            co.toastAllText(res.msg)
            if (index == "1"){
               _this.setData({
                  examineResult: 1
               })
            }else{
               _this.setData({
                  examineResult: 2
               })
            }
         } else {
            co.toastAllText(res.msg)
         }
      })
   },
})